Add GPIO LED states, mode#86
Open
xarantolus wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the gpio-leds device-tree driver with two new properties: default-state (off/on/keep) and osiris,output-mode (push-pull/open-drain). The dtgen codegen now emits two new enums and registry fields, the kernel LED driver consumes them at init time, and the STM32L4 GPIO HAL gains an open-drain configure helper plus a clock-enable helper used to safely read a pre-init pin.
Changes:
- Generate
LedDefaultState/LedOutputModeenums and registry fields from device-tree properties (xtasks/crates/dtgen/src/codegen/led.rs). - Wire the new properties into LED init: pick initial level from
default-state, choose push-pull vs open-drain configure call, and log the mode (src/drivers/led.rs). - Add
gpio_configure_output_odandgpio_clock_enableto the STM32L4 HAL plus matching native Rust wrappers and stub-side enum/struct fields.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| xtasks/crates/dtgen/src/codegen/led.rs | Parse default-state / osiris,output-mode and emit enums + registry fields. |
| src/drivers/led.rs | Use the new fields to choose initial level and configure call (push-pull / open-drain). |
| machine/cortex-m/st/stm32l4/interface/gpio.h | Declare gpio_configure_output_od and gpio_clock_enable. |
| machine/cortex-m/st/stm32l4/interface/gpio.c | Implement open-drain configure and standalone clock-enable helpers. |
| machine/cortex-m/st/stm32l4/interface/export.h | Re-export the two new C symbols. |
| machine/cortex-m/src/native/gpio.rs | Rust wrappers for the two new C functions. |
| machine/cortex-m/src/stub/device_tree.rs | Mirror the new enums/fields on the stub HAL (gpio stub not updated). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.